import hashlib
from django.conf import settings
import uuid


def md5(password):
    """md5加密"""
    password_obj = hashlib.md5(settings.SECRET_KEY.encode("utf-8"))
    password_obj.update(password.encode("utf-8"))
    return password_obj.hexdigest()


def uid(string):
    data = "{}-{}".format(uuid.uuid4(), string)
    return md5(data)